<template>
<h1>猜数字游戏</h1>
  <input type="text" placeholder="请输入你的数字" v-model="num">
  <button @click="eql()">猜一猜</button>
  <h3>{{info}}</h3>
</template>


<script setup>
import {ref} from "vue";

const num = ref('');
const info = ref('');
let n = parseInt(Math.random()*100+1);
const eql = ()=>{

   console.log(n);
  if(n<num.value){
    info.value='猜小了';
  }else if(n>num.value){
    info.value='猜大了';
  }else{
    info.value="猜对了"
  }
}
</script>

<style scoped>

</style>